package com.carbohydrate42.kotlin_compose_demo

import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.carbohydrate42.kotlin_compose_demo.config.Router
import com.carbohydrate42.kotlin_compose_demo.layout.Layout
import com.carbohydrate42.kotlin_compose_demo.page.BlankLayoutPage
import com.carbohydrate42.kotlin_compose_demo.page.Page1
import com.carbohydrate42.kotlin_compose_demo.page.Page2
import com.carbohydrate42.kotlin_compose_demo.page.Page3
import com.carbohydrate42.kotlin_compose_demo.page.SubPage1
import com.carbohydrate42.kotlin_compose_demo.page.SubPage2


@Composable
fun App() {

    val navController = rememberNavController()
    MainState.instance.initNav(navController)

    Layout(navController = navController) { innerPadding ->
        NavHost(
            navController = navController,
            startDestination = Router.Page1.route,
            modifier = Modifier.padding(innerPadding)
        ) {
            composable(Router.Page1.route) {
                Page1()
            }
            composable(Router.Page2.route) {
                Page2()
            }
            composable(Router.Page3.route) {
                Page3()
            }

            composable(Router.SubPage1.route) {
                SubPage1()
            }

            composable(Router.SubPage2.route) {
                SubPage2()
            }

            composable(Router.BlankLayoutPage.route) {
                BlankLayoutPage()
            }

        }
    }
}